package com.illtamer.infinite.morii.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.ByteArrayTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.StringTypeHandler;

import java.util.Date;
import java.util.Map;

@TableName(value = "morii_verify", autoResultMap = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MoriiVerify {

    /**
     * 逻辑主键，自增
     * */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 组
     * */
    @TableField(value = "groupId", jdbcType = JdbcType.VARCHAR)
    private String groupId;

    /**
     * 工件
     * */
    @TableField(value = "artifactId", jdbcType = JdbcType.VARCHAR)
    private String artifactId;

    /**
     * 版本
     * */
    @TableField(value = "version", jdbcType = JdbcType.VARCHAR)
    private String version;

    /**
     * 创建时间
     * */
    @TableField(value = "createTime", jdbcType = JdbcType.DATE)
    private Date createTime;

    /**
     * jar 文件大小
     * */
    @TableField(value = "jarSize", jdbcType = JdbcType.INTEGER)
    private Integer jarSize;

    /**
     * pom 文件大小
     * */
    @TableField(value = "pomSize", jdbcType = JdbcType.INTEGER)
    private Integer pomSize;

    @TableField(value = "pomASC", jdbcType = JdbcType.VARCHAR)
    private String pomASC;

    @TableField(value = "pomMD5", jdbcType = JdbcType.VARCHAR)
    private String pomMD5;

    @TableField(value = "pomSHA1", jdbcType = JdbcType.VARCHAR)
    private String pomSHA1;

    @TableField(value = "jarASC", jdbcType = JdbcType.VARCHAR)
    private String jarASC;

    @TableField(value = "jarMD5", jdbcType = JdbcType.VARCHAR)
    private String jarMD5;

    @TableField(value = "jarSHA1", jdbcType = JdbcType.VARCHAR)
    private String jarSHA1;

    /**
     * 校验文件 Map 集合，操作后自动更新
     * @apiNote {fileType: [asc], [md5], [sha1]}
     * */
    @TableField(exist = false)
    private Map<FileTypeEnum, byte[][]> verifyMap;

}
